


#include "stringUtil.h"
void splitString(const string& str, vector<string>& spiltStrs, const string& pattern){
    int startPos = 0;
    int endPos = 0;
    endPos = str.find(pattern, startPos);
    while (endPos != string::npos){
        spiltStrs.push_back(str.substr(startPos, endPos));
        startPos = endPos+1;
        endPos = str.find(pattern, startPos);
    }
    if(startPos != str.size()){
        spiltStrs.push_back(str.substr(startPos, str.size()));
    }
}

string & trim(string &s, char pattern)
{

    if( !s.empty() )
    {
        s.erase(0,s.find_first_not_of(pattern));
        s.erase(s.find_last_not_of(pattern) + 1);
     }
     return s;

 }

bool startWith(const string& str, char c){
    for(int i=0;i<str.size();i++){
        if(str[i] == ' '){
            continue;
        }
        if(str[i] == c){
            return true;
        }else{
            return false;
        }
    }
    return false;
}
